package com.shbaiche.bifenba.adapter.my;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.shbaiche.bifenba.R;
import com.shbaiche.bifenba.model.GankResults;
import com.shbaiche.bifenba.model.PushModel;

import butterknife.BindView;
import cn.droidlover.xdroid.base.SimpleRecAdapter;
import cn.droidlover.xdroid.kit.KnifeKit;
import cn.droidlover.xdroidbase.imageloader.ILFactory;

/**
 * Created by wanglei on 2016/12/10.
 */

public class MessageListAdapter extends SimpleRecAdapter<PushModel, MessageListAdapter.ViewHolder> {


    public MessageListAdapter(Context context) {
        super(context);
    }

    @Override
    public ViewHolder newViewHolder(View itemView) {
        return new ViewHolder(itemView);
    }

    @Override
    public int getLayoutId() {
        return R.layout.adapter_message_list;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        PushModel item = data.get(position);
        holder.tvTime.setText(item.getTime() + "");
        holder.tvTitle.setText(item.getTitle() + "");
        holder.tvContent.setText(item.getContent() + "");

        //ILFactory.getLoader().loadNet(holder.ivGirl, item.getUrl(), null);

        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (getRecItemClick() != null) {

                }
            }
        });
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.iv_new)
        ImageView ivNew;

        @BindView(R.id.tv_time)
        TextView tvTime;

        @BindView(R.id.tv_title)
        TextView tvTitle;

        @BindView(R.id.tv_content)
        TextView tvContent;


        public ViewHolder(View itemView) {
            super(itemView);
            KnifeKit.bind(this, itemView);
        }
    }
}
